import React, { Component } from 'react';
import F from '../fetch/';

import Temp from './temp';
//import {Link} from 'react-router-dom';
//import Items from '../components/Item';
//import '../App.css';

class User extends Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [],
      json: {
        name: 'jack',
        age: 11,
        school: 'shanghai middel school'
      }
    }
    F.User.main(this);
    //const token=sessionStorage.token;"Authorization":token
    /*fetch(`//bd:4000/product/${props.match.params.id}`,{
        method:'GET',
        headers:{
            "Content-Type": "application/json"
        }
    }).then(res=>{
        res.json().then(data=>{
            //console.log(data)
            if(data) {
              this.setState({
                data,
                imgurl:`//bd:4000/${data.proImg}`
              })
            }
        })
    })*/
  }
  render() {
    return (
      <div className="User">
        <Temp title="用户">
          <label htmlFor="user">用户</label>
          <input type="text" name="user" />
          {
            Object.keys(this.state.json).map((item, index) => {
              return <p key={index}>{item}</p>
            })
          }
          <p><img className="lazy" src={this.state.imgurl} alt="proudct" width='100%' /></p>
          <p>{this.state.data.name}</p>
          <p>{this.state.data.price}</p>
        </Temp>
      </div>
    );
  }
}
//
export default User;
